using IcecreamView;
using UnityEngine.Serialization;
using UnityEngine.UI;

namespace View.Common
{
    public class CommonLoad : IC_AbstractModule
    {

        public LoadInfo[] LoadInfos;

        public override void OnInitView()
        {
            if (this.LoadInfos.Length == 0)
                return;
            foreach (var infos in this.LoadInfos)
                infos.Button?.onClick.AddListener(() => { this.ViewConnector.OpenView(infos.ToViewName, infos.IsCloseThis); });
        }

    }
    
    [System.Serializable]
    public class LoadInfo
    {
        public Button Button;
        public string ToViewName;
        public bool IsCloseThis;
    }
}